package com.atguigu.gmall.order.service;

import com.atguigu.gmall.model.enums.ProcessStatus;
import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.mapper.OrderInfoMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Ordering;

/**
 * @Description:
 * @author: JC
 * @date: 2021/11/9 12:48
 */
public interface OrderService extends IService<OrderInfo>{

    /**
     * 保存订单
     * @param orderInfo
     * @return 返回订单编号
     */
    Long saveOrderInfo(OrderInfo orderInfo);

    /**
     * 获取交易号
     * @param userId
     * @return
     */
    String getTradeNo(String userId);


    /**
     * 检查交易号
     * @param tradeNo
     * @param userId
     * @return
     */
    Boolean checkedTradeNo(String tradeNo, String userId);

    Boolean deleteTradeNo(String userId);

    boolean checkStock(Long skuId, Integer skuNum);

    /**
     * 订单超时
     * @param orderId
     */
    void execExpiredOrder(Long orderId);

    /**
     * 根据订单Id 修改订单的状态
     * @param orderId
     * @param processStatus
     */
    void updateOrderStatus(Long orderId, ProcessStatus processStatus);

    /**
     * 根据订单Id 查询订单信息
     * @param orderId
     * @return
     */
    OrderInfo getOrderInfo(Long orderId);

    void updateWareOrderStatus(Long orderId);
}
